package com.nbsaas.boot.project.rest.resource;

import com.nbsaas.boot.jpa.data.core.BaseResource;
import com.nbsaas.boot.project.api.apis.ProjectTaskCommentApi;
import com.nbsaas.boot.project.api.domain.request.ProjectTaskCommentRequest;
import com.nbsaas.boot.project.api.domain.response.ProjectTaskCommentResponse;
import com.nbsaas.boot.project.api.domain.simple.ProjectTaskCommentSimple;
import com.nbsaas.boot.project.data.entity.ProjectTaskComment;
import com.nbsaas.boot.project.data.repository.ProjectTaskCommentRepository;
import com.nbsaas.boot.project.rest.convert.ProjectTaskCommentEntityConvert;
import com.nbsaas.boot.project.rest.convert.ProjectTaskCommentResponseConvert;
import com.nbsaas.boot.project.rest.convert.ProjectTaskCommentSimpleConvert;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.function.Function;
/**
 *   任务评论-业务接口实现
 */
@Transactional
@Service
public class ProjectTaskCommentResource extends BaseResource<ProjectTaskComment, ProjectTaskCommentResponse, ProjectTaskCommentSimple, ProjectTaskCommentRequest> implements ProjectTaskCommentApi {

    @Resource
    private ProjectTaskCommentRepository projectTaskCommentRepository;

    @Override
    public JpaRepositoryImplementation<ProjectTaskComment, Serializable> getJpaRepository() {
        return projectTaskCommentRepository;
    }

    @Override
    public Function<ProjectTaskComment, ProjectTaskCommentSimple> getConvertSimple() {
        return new ProjectTaskCommentSimpleConvert();
    }

    @Override
    public Function<ProjectTaskCommentRequest, ProjectTaskComment> getConvertForm() {
        return new ProjectTaskCommentEntityConvert();
    }

    @Override
    public Function<ProjectTaskComment, ProjectTaskCommentResponse> getConvertResponse() {
        return new ProjectTaskCommentResponseConvert();
    }


}


